package cn.cnsuh.q647_countSubstrings;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        System.out.println("countSubstrings(line) = " + countSubstrings(line));

    }
    static int countSubstrings(String s) {
        int ans = s.length();
        for (int i = 0; i < s.length(); i++) {
            for (int j = i + 2; j <s.length()+1 ; j++) {
                if(isReverse(s.substring(i,j))){
                    ans++;
                }
            }
        }
        return ans;
    }

    static boolean isReverse(String s){
        StringBuilder sb = new StringBuilder(s);
        if(sb.reverse().toString().equals(s)){
            return true;
        }else{
            return false;
        }
    }
}
